package com.web.daoimpl;

import com.web.dao.ClassDao;
import com.web.entity.ClassInfo;
import com.web.util.DatabaseUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author 17612
 */
public class ClassDaoImpl extends BaseDaoImpl implements ClassDao{

    @Override
    public ClassInfo getClassByClassID(String ClassID) {
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        ClassInfo c = null;
        try {
            con = DatabaseUtil.getConnection();
            ps = con.prepareStatement("select * from Class where ClassID=?");
            ps.setString(1, ClassID);
            rs = ps.executeQuery();
            while (rs.next()){
                c = new ClassInfo(rs.getString(1),rs.getString(2));
            } 
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            DatabaseUtil.close(rs, ps, con);
        }
        return c;        
    }
    }
    

